/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Raytracing.Shaders;

import processing.core.PApplet;
import processing.core.PVector;

/**
 *
 * @author Matt
 */
public class Noise extends TextureProvider{

    PApplet parent;
    float scaleX = 1;
    float scaleY = 1;
    
    public Noise(PApplet parent, float scaleX, float scaleY){
        this.parent = parent;
        parent.noiseDetail(8);
    }
    
    public void getColor(float u, float v, PVector ret) {
        ret.x = parent.noise(u*scaleX, v*scaleY);
        
        if (ret.x <= .2f) ret.x = 0;
        if (ret.x > .8f) ret.x = 1.f;
        ret.y = ret.x;
        ret.z = ret.x;
    }
    
}
